package com.springvue.springvue.config;


import java.io.Serializable;

//@NoArgsConstructor
//@Data
public class JsonResult<T> implements Serializable {
    private String msg;
    private Integer code;
    private T data;

    //不返回数据，返回状态码和自定义message
    public  JsonResult(Integer code,String msg){
        this.code=code;
        this.msg=msg;
    }

    //返回数据，状态码固定是200成功，message固定是成功
    public JsonResult(T data){
        this.code=200;
        this.msg="操作成功";
        this.data=data;
    }

    //不返回数据 返回状态码为200，自定义mesage
    public JsonResult(T data, String msg){
        this.code=200;
        this.msg=msg;
        this.data=data;
    }

     public String getMsg(){
        return msg;
     }
     public void setMsg(String msg){
        this.msg=msg;
     }
     public Integer getCode(){
        return code;
     }
     public void setCode(Integer code){
        this.code=code;
     }
     public T getData(){
        return data;
     }
     public void setData(T data){
        this.data=data;
     }

}
